package gulimall.pojo.bo;

import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 * 用户注册提交的参数
 *
 * @author HLF
 * @date 2022/7/31 17:21
 */
@Data
public class UserRegBO {

    @NotBlank(message = "用户名不能为空")
    @Length(max = 18, min = 6, message = "用户名必须是6-18位字符")
    private String username;

    @NotBlank(message = "密码不能为空")
    @Length(max = 18, min = 6, message = "密码必须是6-18位字符")
    private String password;


    /**
     * 手机号格式：1开头的11位数的手机号
     */
    @NotBlank(message = "手机号不能为空")
    @Pattern(regexp = "^[1]([3-9])[0-9]{9}$", message = "手机号格式不正确")
    private String phone;

    @NotBlank(message = "验证码不能为空")
    private String code;
}
